home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
LVSWIN31.ARJ
/
LVSWIN.DOC
< prev
next >
Wrap
Text File
|
1992-02-26
|
98KB
|
2,481 lines
LVS Windows (tm)
v3.1
The C++ Window Class System
by
Lake View Software
Copyright (c) 1991, 1992, Lake View Software
All Rights Reserved
Features of LVS Windows
- Powerful windowing system. Allows as many window objects as
memory permits. Windows objects can be stacked, tiled, moved,
resized, and changed in many other ways. There is a whole
assortment of various input and output messages to interact with
windows. All windows are active and can be written to at any time.
- All windows can be virtual. This allows you to create windows
larger than the screen. Data entry screens automatically pan around
the virtual window as the user moves the cursor. The user can also
use the mouse to pan a window.
- Multi-field formatted data entry. You can create data entry forms
that consist of one or more input fields. You have full control
over user input and can tie validation functions into each input
field.
- As of version 1.6, there are functions specific designed to
support the Paradox Engine. Paradox Engine is a trade mark of
Borland. These functions allow you to read user input directly from
a Paradox Record Buffer. Large model only.
- Moving bar menus. You can easily create pop-up, pull-down, and
Lotus-style menus, as well as any other custom menu that you can
define. All with automatic mouse support.
- Scrollable pick menus. Allow you to pick one item from a list of
items. Also with mouse support.
- Several video output methods. These include direct screen
writing, CGA snow reduction, and video BIOS writing. 28 and 50 line
modes available on color VGA screens.
- Keyboard management routines. Allows you to tie keystrokes to
functions, and specify a function to be called while waiting for a
keypress.
- Full mouse support is available with all these routines. One
function call and the mouse is enabled. No other work necessary,
though you can manipulate mickey if you wish.
Registration Information
LVS Windows is distributed as User-Supported software. You are free to
copy and distribute this software freely*, however, if you find it of use
to you, you are encouraged to register your copy. Registering your copy
of the software helps the author continue to provide professional quality
software at very reasonable prices.
*** Only Small Memory Model Libraries may be distributed ***
*** with out written consent from Lake View Software *****
The Full Registration is $50.00 and includes all memory models plus full
library source. The library is written in C++ and is compatible with
Turbo C++ v1.x, Borland C++ v2.0 & 3.0, and Zortech C++ v3.0. All window
classes use the same low-level C functions. This allows easy porting to
other operating systems.
All materials are shipped on 5.25-inch or 3.5-inch floppy diskettes.
Please specify when ordering.
U.S. orders add $4.00 shipping & handling.
Non-U.S. orders need to include $5.00 extra to cover additional shipping
and handling charges. Checks and money orders must be drawn on a U.S.
bank. Total of $59.00 US dollars
To order direct from LVS, Please send all payments payable in U.S.
Dollars to:
╔════════════════════════════════╗
║ Lake View Software ║
║ 4321 Harborough Rd. ║
║ Columbus, OH 43220 ║
╚════════════════════════════════╝
All major upgrades will be available for only $15.00 + $4.00 s/h.
Registered users will be notified of all major upgrades.
All non-major upgrades will be available for a $4.00 shipping fee.
All new releases will be posted on CompuServe in the BPROGB forum.
Please report any errors (BUGS) or suggestions
to Lake View Software or:
CompuServe: 70004,524
You can order directly from Lake View Software with a check or money
order, or from the Public (software) Library with your MC, Visa, AMX or
Discover card by calling 800-2424-PsL, P.O. Box 35705, Houston, Texas
77235-5705. PsL is for ordering only. For information about dealer
pricing, volume discounts, site licensing, shipping of product, returns,
latest version number or other technical information, Send your request
to Lake View Software at the above address or send an Easy Plex on
CompuServe at [70004,524].
When ordering from Public (software) Library refer to this product number:
#10224.
Files
LVSWIN.WP This file, in Word Perfect 5.1 format.
LVSWIN.DOC This file in DOS text format.
LVSWIN_S.LIB LVS small model library. You must link to this file to
use any of the windows object messages. The demo is
distributed with the Small model library only.
LVSWIN.HPP LVSwin class definitions. Must be #included in your
program to link with winobj.lib. This will also include
LVSwin.h. Always use the header files that come with
the library, discard previous versions.
LVSMENU.HPP WinMenu class definitions. Must be #included in any
program using the menuing system. This header file will
include lvswin.hpp with it.
LVSPICK.HPP WinPick class definitions. Will include winobj.hpp with
it.
LVSWIN.H Defines low level .C functions used by LVSwin_?.lib.
Also defines various window function options and key
strokes. This is automatically included with LVSwin.hpp
or any other winobj class headers.
DEMO.CPP Source code for the demo.
DEMO2.CPP Demo programs written using LVS Windows. These demos
DEMO3.CPP uses many of the key features of LVS and makes a good
DEMO4.CPP working example. See demo.doc for instructions on
building/using the demos.
Declaring a Window Object
WinObj <Object> (int v_h=0,int v_w=0)
v_h Virtual height of the window. Default is 0 If declared as the
default (0) then the virtual height will be set to the height of the
window when it is opened.
v_w Virtual width of the window. Default is 0 If declared as the
default (0) then the virtual width will be set to the width of the
window when it is opened.
The virtual height and width can be changed any time the window is
not opened, using the set_virtual message.
EXAMPLE:
WinObj window_a;
main()
{
WinObj window_b ( 100, 100);
~ ~ ~ ~
~ ~ ~
~ ~ ~
}
WinObj Routines
box
Draw a box in the window. The current window attribute will be used. The
cursor position will be unchanged.
USAGE: void box (int sr, int sc, int er, int ec, int type =
W_SINGLE);
sr = start row.
sc = start column.
er = end row.
ec = end column.
type = Box style. Can be any of the valid border styles.
========================================
center
Centers a string in the virtual window, using the current attribute.
USAGE: int center (int y, char *str);
RETURNS: W_OK, W_NOTOPEN
========================================
change_border
Changes the border style for the window object. Optionally changes the
border color.
USAGE: void change_border (int type, int color = -1);
Required arguments.
type new border type. Use any of the types below.
W_SPACES W_SINDOU
W_DOUBLE W_SINGLE
W_DOUSIN W_SOLID
Optional arguments.
color new border attribute. Default is -1 which will leave
border color unchanged.
EXAMPLE:
main()
{
WinObj a;
a.open (12,12,20,50);
~~~
a.change_border ( W_DOUSIN, _BLUE|WHITE);
~~
~
a.close();
}
=======================================
close
Close the window object. A window object can be opened and closed as
often as you like through its life. A window will automatically be closed
when it leaves the scope of your application.
USAGE: void close();
EXAMPLE:
main()
{
WinObj a;
a.open (12,12,20,50);
~~~
~~
~
a.close();
a.open (10,10,15,35,W_SPACES,_BLUE|GREEN);
a.close();
}
=======================================
clr_eol
Clears the window to the end of the current line. The cursor position is
not changed.
USAGE: void clr_eol ();
=======================================
clr_win
Clears the window with the current attribute.
USAGE: void clr_win ();
EXAMPLE:
main()
{
WinObj a;
a.open (1,1,12,40);
a.printf ("This is a test string.");
a.set_attr (_BLUE|WHITE);
a.clr_win ();
a.close ();
}
=======================================
del_line
Deletes a line in the window object. All text below the line is pulled up
and a blank line is inserted at the end. The cursor position will not be
changed.
USAGE: void del_line (int y);
y row to be deleted.
=======================================
gotoxy
Move the cursor inside the window.
USAGE: void gotoxy (int y = 0, int x = 0);
Optional arguments.
y New y location. default to origin. If y is 1 greater than
max_y the window will scroll up 1 line and a blank line will
be inserted at the end.
x New x location. default to origin.
EXAMPLE:
main()
{
WinObj a;
a.open (12,12,20,50);
~~~
a.gotoxy(5,5);
~
a.close();
}
=======================================
hide
Hides the window object. None of the window contents will be changed.
A window may be hidden before it is opened. This will allow you to build
the window at one time and unhide it later.
USAGE: void hide ();
=======================================
ins_line
Insert a line in the window object. All text from the line down is pushed
down. The last line will be pushed out of the window. A blank line will
be inserted. The cursor position will not change.
USAGE: void ins_line (int y);
y row number to be inserted.
=======================================
move
Moves a window on the screen. The window contents are left in tact. The
window does not have to be active to move. It will slide under other
windows if needed.
USAGE: int move (int start_y, int start_x);
start y/x new start coordinates for the upper left of the window
object.
RETURNS: W_OK, or W_ERROR if your coordinates cause the window to move
off the screen.
=======================================
open
Opens a window object on the screen.
USAGE: int open (int sr,int sc,int er,int ec,
int btype=W_DOUBLE,
int wattr=_BLACK|LGREY,
int battr=_BLACK|LGREY)
RETURNS: 0 if successful.
Required arguments.
sr Start row for the window.
sc Start column for the window.
er End row for the window.
ec End column for the window.
Optional arguments.
btype Border type. default is W_DOUBLE.
W_NOBORDER W_SPACES
W_DOUBLE W_SINGLE
W_DOUSIN W_SOLID
W_SINDOU
wattr Window attribute. default is _BLACK|LGREY.
battr Border attribute. default is _BLACK|LGREY.
EXAMPLE:
main()
{
WinObj a;
a.open (12,12,20,50);
~~~
~~
~
}
=======================================
pan
Adjust the virtual window by delta number of characters. The window
automatically adjusts its pan location when the user moves the cursor.
This keeps the cursor always in the visible window. You can use pan to
adjust it manually if you need.
USAGE: int pan (int delta_y, int delta_x);
delta_y, the change in the x and y start coordinate.
delta_x
RETURNS: W_OK, W_NOTOPEN
SEE: set_pan()
=======================================
printf
Display a formatted string in the window at the current cursor position.
This function works very much like the printf function in C. This also
has an optional xy coordinates.
If the y coordinate is 1 greater than max_y the window will scroll up 1
line and the new text will be inserted on a new blank line.
USAGE: void printf (char *,...);
void printf ( int y, int x, char *,...);
EXAMPLE:
main()
{
WinObj a;
int i = 2;
a.open (12,12,20,50);
a.gotoxy (5,5);
a.printf ("( 2 + 2 = %d )",i+2);
a.gotoxy ();
a.printf ("This is the window origin.");
~
a.close ();
}
=======================================
putch
Display a single character in the window. Cursor position will be updated
to the next window character. The current window attribute will be used.
USAGE: void putch (char ch, int translate=W_OFF);
void putch (int y, int x, char ch, int trans=W_OFF);
translate W_ON, LF will cause a cr/lf. CR will be ignored. \t
will tab to the next tab position. The default is to
not translate.
=======================================
puts
Display a simple string to the window. Cursor position will be updated to
the next window character. The current window attribute will be used.
USAGE: void puts (char *str, int translate=W_ON);
void puts (int y, int x, char *str, translate=W_ON);
translate W_ON, LF will cause a cr/lf. CR will be ignored. \t
will tab to the next tab position. The default is to
not translate.
=======================================
set_active
Brings a window to the surface. This will also unhide a function.
Set_active is called each time you input a keystroke from a window.
USAGE: void set_active ();
=======================================
set_attr
Sets a new default attribute for the window object.
USAGE: int set_attr (int new_attr);
Required arguments.
new_attr New attribute for window. Can be any legal color
Mono screens will be remapped to use only black on white
or white on black. This is automatic.
RETURNS: previous attribute.
EXAMPLE:
main()
{
WinObj a;
a.open (12,12,20,50);
~~~
a.new_attr (_RED|YELLOW); // All characters from this point will
be displayed as yellow on red.
~~~
~~
~
a.close();
}
=======================================
set_attr
changes the attribute for a region in a window.
USAGE: void set_attr (int new_attr, int y, int x, int cnt = 1);
new_attr new attribute for the region.
y,x start y,x coordinates.
cnt number of characters to change. default is 1.
=======================================
set_fill
Set the window fill character. Default is spaces.
USAGE: void set_fill (char ch);
=======================================
set_virtual
Changes the virtual height and width of a window. This can only be done
when the window is closed.
USAGE: int set_virtual (int vh, int vw);
vh new virtual height.
vw new virtual width.
Setting the vh and/or vw to zero causes them to be automatically set when
open is called.
RETURNS: W_OK or W_OPENED
=======================================
size
Set a new size for the displayed window object. The virtual height and
width are left unchanged. This means you can not make a window larger
than its virtual sizes.
USAGE: int size (int new_height, int new_width);
RETURNS: W_OK, or W_ERROR if your new size is less than 1.
=======================================
title
Add, change or remove a window title. The window title will have the same
attribute as the window border.
USAGE: void title (char *str, int position = W_CENTER);
Required arguments.
str Title string to display. If NULL then the window title
will be removed.
Optional arguments.
position Position of the title. Default is W_CENTER.
W_CENTER W_LEFT W_RIGHT
EXAMPLE:
main()
{
WinObj a;
a.open (12,12,20,50);
a.title ("[ Window 1 ]", W_LEFT);
~~~
~
a.close();
}
=======================================
unhide
Unhide a hidden window object.
USAGE: void unhide ();
=======================================
update
Update the window object. This will display all buffered output. The
window does not have to be the active window to be updated.
USAGE: void update ();
EXAMPLE: see printf
=======================================
update_all
Update all non hidden, open windows. The order of active windows will not
change. You can call this method from any window object. This will be
most useful if your screen is damaged by some external program.
USAGE: void update_all ();
=======================================
allow_user_moves
Turn the users ability to move/resize/scroll a window with the mouse. By
default the user has the ability to adjust any window with a border.
USAGE: void allow_user_moves (int true_false)
TRUE is the default. FALSE prevents the user from adjusting
that window.
The << operator
The << operator can be used for window output. This is handy for those
who are use to the C++ ostream library. The << operator has an override
for all the basic C data types. The gotoxy routine has also been modified
to return a WinObj& which allows you to position the cursor and output
with << on the same line.
EXAMPLES:
WinObj w;
w.open (.....);
w.gotoxy (y, x) << "The answer is " << x;
w << '\n' << string << number << string << '\n';
w << "12 + 12 = " << 12+12;
Also see the Demo program for examples using the << operator.Mouse Routines
You must have a MicroSoft compatible mouse with mouse.com loaded for mouse
support. The mouse has 2 modes of operation. The program can switch
between these modes at any time.
To activate the mouse in your program you just make one function call:
Win_mouse_mode (mode);
mode:
M_FULL full mouse support
M_SIMPLE simple mouse support
M_NONE no mouse support
This routine is defined in WinMouse.HPP. The definitions of the support
modes are listed below.
Simple support:
- there will be no mouse cursor present.
- moveing the mouse is equal to using the arrow keys.
- the right mouse button equates to the ESC key.
- the left mouse button equates to ENTER.
Full support:
- there will be a mouse cursor.
- the right mouse button equates to the ESC key.
- to make a menu selection, click the left button on the item of
your choice.
- you can move any bordered window. Move the mouse cursor to the
top border of the window you wish to move. Press and hold the left
mouse button. The top left edge of the window will follow the mouse
cursor until you release the left button.
- you can resize any bordered window. Move the mouse cursor to the
bottom right corner of the window. Press and hold the left mouse
button. You can now make the window shrink and grow by moving the
mouse. The max size for any window is its virtual size. Any window
which is smaller than its virtual size will have panning arrows on
the left and/or bottom border.
- you can pan a window which has a virtual size larger then its
fisical size. Just click on the panning arrows on the left or top
border. Holding down on the left button will cause the window to
pan until the end.
- you can scroll a pick list by clicking on the up/down arrows on
the left border of the window.
- you can move the text cursor in a data entry window by clicking on
the field of your choice.
The mouse support is created with a mouse class. The class object is
declared in WinMouse.CPP. This is a global object so you have access to
it, but be sure you understand the WinMouse class before accessing the
object directly.
The Object is declared as WinMouse Win_mouse (M_NONE);
You can safely use the following routines with LVS Windows.
Win_mouse_mode
Use this routine to change the mouse mode. You can change the mode at any
time during your program.
USAGE: int Win_mouse_mode (int mode);
mode M_FULL
M_SIMPLE
M_NONE turns mouse off
RETURNS: 0 if no mouse detected
-1 if mouse is present
=======================================
set_mouseroutine
Each WinObj object is allowed a mouse routine. This routine will be
called whenever a mouse click is detected in the bound of the window. The
routine will even be called when the window is not the active window. By
default each window object has no mouse routine.
USAGE: mouse_routine_t set_mouseroutine (mouse_routine_t);
mouse_routine_t is defined as a void function which takes two
integers as arguments.
ie: void Routine (int y, int x);
RETURNS: a pointer to the previous routine. Usualy you will ignore
this.
NOTES: The Y/X values passed to the routine are the x/y coordinates
within the window. They are the windows coordinates not the
screen coordinates.
EXAMPLE:
void My_Mouse_Routine (int y, int x)
{
Do something with the mouse click here.
You have been passed the coordinates of the click
so be creative.
}
void main ()
{
WinObj w;
Win_mouse_mode (M_FULL);
w.open (.....);
w.set_mouseroutine (My_Mouse_Routine);
.......
.......
} Input Routines
before
Assign a before get function to the previous get. This function will be
called before the get takes place.
USAGE: int before (void (*func)(void *));
func() will be called each time the user enters the get field.
The before function will be called with a void pointer to the current get
object. This can be a int, long, double or string pointer.
RETURNS: W_OK if successful.
W_ERROR if no previous get.
=======================================
get_key
Get a key from the keyboard at the current window location. A refresh
will be automatically called if needed. The physical cursor will be moved
to the correct window location. You have an option of whether the key
will be echoed or not. You can also cause a time out.
USAGE: int get_key (int echo = W_NOECHO, int seconds = 0);
Optional arguments.
echo Determine whether or not to echo the keystroke to the
window. default = no echo. W_ECHO W_NOECHO
seconds Max time to wait for a key. 0 is forever.
RETURNS: Ascii and key scan code from win.h.
key & 0x00ff = Ascii character returned
key >>8 = Scan code.
EXAMPLE:
main()
{
WinObj a;
a.open (1, 1, 12, 40);
a.printf ("This is a test string.");
a.printf (2,0,"Press Escape to exit.");
while (a.get_key() != ESC);
a.close ();
}
=======================================
get
Get a variable from a screen window. Will display each get with the
current get_attr attribute. The compiler will determine which of the
following gets will be called. You will have different options with
different variable types.
USAGE:
int get (int y, int x, int &i, int len=4);
Gets an integer from the window. ex: get (1, 1, i); default
length is 4.
int get (int y, int x, long int &i, int len=5);
Gets a long int from the window. ex: get (1, 1, ld, 10);
default length is 5.
int get (int y, int x, double &d, int len=10, int dec=2);
Gets a double from the window. ex: get (1, 1, d, 5, 1);
Default length is 10 with 2 decimals. The length includes the
decimal place. The decimal places can be from 1 to length -
2.
int get (int y, int x, char *str, char *picture=NULL);
Gets a picture char string from the window.
ex: get (1, 1, str, "XXX-999-xxx");
int get (int y, int x, char *str, char style, int length = 0);
Gets a styled string from the window. The valid styles are
listed below. The default length is 0. 0 uses the current
length of the string or the predefined length of style.
int get (int y, int x, char ch, int upper_case = 0);
Gets a single character from the screen. The upper case flag
defaults to 0 which allows any character. Any non zero value
will force upper case.
Valid Picture characters.
x Allow any character.
X Allow any character. Letters will be converted to upper case.
a Allow letters and spaces only.
A Allow letters and spaces only. Letters will be converted to
upper case.
9 Allow numbers and spaces only.
Any other characters in a picture clause will be forced into the
output string. ie ( , - and even spaces.
Valid Styles: found in WIN.H
LOWER_STYLE convert field to 'L'owercase.
UPPER_STYLE convert field to 'U'ppercase.
FIRST_STYLE convert 'F'irst character to upper-case.
DATE_STYLE MM/DD/YY date field.
SS_STYLE 999-99-9999 Social Security number field
PHONE_STYLE (999) 999-9999 phone number.
ZIP_STYLE 99999-9999 zip code.
ANY_STYLE any character mix.
Notes: If a NO picture is used the length of the string (str) will be
used and any characters will be allowed. This is the default.
Be sure you have a NULL terminated string.
The length of the picture clause will override the len of the
string.
If a style is used be sure the char * has enough space to
accommodate the style type. The length option can be used to
control the length of the string. However if the style is of
a fixed length the style will override the length. The len
option is only useful for styles L, U, and F. If len is 0
the length of the string will be used for len.
EXAMPLES:
main
{
WinObj w;
char state[] = " ";
long i=0;
double d;
char phone[16]="";
char name[16]="", ss[12]="";
char company[31]="";
w.open (0, 0, 24, 79);
w.get (10,10,state,UPPER_STYLE); // state forced to upper case.
w.get (12,10,i,3); // get a 3 digit integer.
w.get (13,10,d); // get a 2 decimal double, 10 chars. long
w.get (15,10,name,"Xxxxxxxxxxxxxx") // get a 15 char. name with
the first character
forced to upper.
w.get (20,10,phone,"(999) 999-9999"); // get a phone number using
a picture statement.
w.get (21,10,ss,SS_STYLE); // get a ss # using a
style.
w.get (22,10,company,FIRST_STYLE,30); // get ucase string
with length
specified.
w.read ();
}
RETURNS: W_OK if successful.
W_ERROR if invalid x,y.
W_NOTOPEN if window not opened.
=======================================
get_button
Add a button to the get list. Just like get () this creates an object in
a window to prompt the user for input. The get will use the current get
attribute (see set_getattr ()) when displayed. While reading, the user
will get to the button in order with the rest of the gets. When a button
is the active get its attribute will be reversed, to give the user a
distinction.
USAGE: int get_button (int y, int x, char *str,
button_func bf, int value);
y, x - Coordinates for the button.
str - Button text. Also determines size of the button
bf - Function to call when the user press Enter or Space on
the button. A mouse click on the button will also cause
this function to be called. The function must be
defined as 'int bf (int)'. The function will be called
with the value you provide. The return value of this
function will be stuffed into the keyboard. If the bf
function returns 0, the button remains active.
value - Value to call bf with.
RETURNS: W_OK, W_NOTOPEN or W_ERROR.
EXAMPLE:
int button_press (int value)
{
switch (value)
{
case 1:
return PGDN; // return a normal exit
case 2:
return ESC; // return an escape
}
}
void main ()
{
WinObj w;
w.open (....);
w.get (1, 1, str, UPPER_STYLE);
w.get (3, 1, str2, LOWER_STYLE);
w.get ....
/* Change the attr for the buttons */
w.set_getattr (_GREEN|BLACK);
/* Get the buttons */
w.get_button (1, 40, " OK ", button_press, 1);
w.get_button (3, 40, " Cancel ", button_press, 2);
/* Read from the user */
w.read ();
}
===============================================
get_checkbox
Add a check box to the get list. Just like get () this creates an object
in a window to prompt the user for input. The get will use the current
get attribute (see set_getattr ()) when displayed. While reading, the
user will get to the check box in order with the rest of the gets. When
a check box is the active get, it will be displayed with its getatt, to
give the user a distinction. When it is not the current get it will be
displayed with the windows attribute at the time you called get_checkbox.
The user can turn checks on and off by using Enter or the Space-bar. The
box can also be toggled with the mouse.
USAGE: int get_checkbox (int y, int x, char *str, int &result);
y, x - coordinates for the upper left corner of the
radio.
str - string to display as the check box
result - initial value of the box. 0 indicates no
check, non zero indicates a check. The final
state of the check will be displayed in this int.
RETURNS: W_OK if get was successfull. W_ERROR if the window was
not opened, out of memory or some other error.
EXAMPLES: See DEMO2.CPP for an example.
===============================================
get_radio
Add a radio button list to the get list. Just like get () this creates an
object in a window to prompt the user for input. The get will use the
current get attribute (see set_getattr ()) when displayed. While reading,
the user will get to the radio button in order with the rest of the gets.
When a radio is the active get, the currently selected button will be
displayed in the getattr color. The cursor will be located on that line
as well. When it is not the current get it will be displayed with the
windows attribute at the time you called get_radio.
The user can select only one button in your radio. To select a button the
can cursor to the button of their choice and press Enter or Space. The
button can also be selected with the mouse.
USAGE: int get_radio (int y, int x, char *button_lst,
int &value, int cnt);
y, x - coordinates for the upper left corner of the
radio.
button_lst - list of buttons for the radio.
value - currently selected button (0 - (cnt-1)). This
is also where you'll get your return value.
cnt - number of buttons in the radio list.
RETURNS: W_OK if get was successfull. W_ERROR if the window was
not opened, out of memory or some other error.
EXAMPLES: See DEMO2.CPP for an example.
===============================================
set_getattr
Change the get attribute. The default is _LGREY | BLACK. This will set
the attribute for all gets to follow. This allows you to have a different
attribute for every get.
USAGE: int set_getattr (int new_attr);
RETURNS: previous attribute.
Note: If new_attr < 0 then the old attribute is returned but not
altered.
=======================================
update_gets
Update display of gets. Safe to call from within read. This can be used
to change the value of some of the gets in a valid function. This will
display the changes. Warning: No pictures will be checked. Also do not
change string lengths.
USAGE: int update_gets ();
RETURNS: W_OK or W_NOTOPEN
=======================================
valid
Assign a valid function to the previous get.
USAGE: int valid (int (*func) (void *));
func() will be called each time the user attempts to leave the get field.
read() will not let the user leave the current get until your valid
function returns a non zero value. The read function will let the user
exit the read with a press of ESC regardless if the valid function returns
true.
The valid function will be called with a pointer to the current get
object. This can be a long, double or string pointer.
RETURNS: W_OK if successful.
W_ERROR if no previous get.
=======================================
clear_gets
Clear all gets for a window. This allows you to use the get system to
display the data but not read it from the screen.
USAGE: void clear_gets ()
=======================================
read
Read all gets from the window object.
USAGE: int read();
During the read the user can perform the following.
Up/Down arrows Move to the previous/next field.
Shift-Tab/Tab Move to the previous/next field.
Enter Move to the next field or exit the read if
currently on the last field.
Right arrow Move right one character in a string field.
Left arrow Move left one character in a string field. Acts
like a backspace in numeric fields.
End/Home Move to the last/first character in a string
field.
Ctrl-right/ Pan the window right/left one character.
Ctrl-left arrow
Ctrl-Home/ Pan the window up/down one character.
Ctrl-End
RETURNS: Key pressed to exit read. User can exit with an Enter on the
last field, Escape, PgUp or PgDn.
=======================================
any_read_change
Allows you to test if a user made any changes during the previous read.
USAGE: int any_read_change ();
RETURNS: 0 if no changes were made.
non zero if changes were made.Information Routines
do_youown
Ask a window object if it owns a coordinate on the screen. If it does
then return the character and attribute of that coordinate. Owning a
coordinate means the window is the most active in that spot on the screen.
It is possible for a window to use a spot on the screen but not be the
current owner. A hidden window owns NO spots on the screen.
USAGE: int do_youown (int y, int x, char &ch, char &attr);
y,x physical screen coordinates. 0,0 origin
ch will return with the character if owned.
attr will return with the attribute if owned
RETURNS: 0 if not owned.
1 if the window owns the coordinate.
SEE: who_owns()
========================================
get_pan
get the current virtual starting point for the displayed window.
USAGE: int get_pan (int &y, int &x)
When called, get_pan will set y,x to the current start location for
the virtual window.
RETURNS: W_OK or W_NOTOPEN.
========================================
get_scr
get the current screen location of the window.
USAGE: int get_scr (int &sr, int &sc, int &er, int &ec);
When called, get_scr will set sr,sc,er,ec to the current window
location on the screen.
RETURNS: W_OK or W_NOTOPEN
========================================
get_version
Return a pointer to the version of object windows.
USAGE: char *get_version ();
RETURNS: a pointer to "LVS Windows v##.##"
========================================
is_open
report windows open status.
USAGE: int is_open ();
RETURNS: true if open, 0 if not.
========================================
max_x
get maximum x coordinate for window.
USAGE: int max_x ();
RETURNS: max x coordinate or W_NOTOPEN if window is not opened.
========================================
max_y
get maximum y coordinate for window.
USAGE: int max_y();
RETURNS: max y coordinate or W_NOTOPEN if window is not opened.
========================================
ret_char
retrieve a character from a window object.
USAGE: int ret_attr (int y, int x);
x,y Coordinates within the window.
RETURNS: The ascii value of the character at the given window
coordinates.
========================================
ret_attr
retrieve an attribute from a window object.
USAGE: int ret_attr (int y,int x);
RETURNS: The attribute value of the character at the given window
coordinates.
========================================
wherex
Returns the current cursor column.
USAGE: int wherex ();
RETURNS: the current x coordinate
========================================
wherey
Returns the current cursor row.
USAGE: int wherey ();
RETURNS: the current y coordinate
========================================
wherexy
get the current cursor location for the window.
USAGE: int wherexy (int &y, int &x);
When called, wherexy will set y,x to the current cursor coordinates
RETURNS: W_OK or W_NOTOPEN.
========================================
who_owns
Return a pointer to the window object which owns a coordinate on the
screen.
USAGE: WinObj *who_owns (int y, int x, char &ch, char &attr);
y,x physical screen coordinates. 0,0 origin.
ch will return with the character if owned by anyone.
attr will return with the attribute if owned by anyone.
RETURNS: A pointer to the window object who owns the spot on the
screen. 0 if not owned.
Printer Objects
Declaring a Printer Object
Win_Prn <Object> (char *port = "LPT1", int v_h=66,int v_w=132)
port This is the printer port to use. The default is LPT1. You
can print to any legal DOS file name. This includes LPT2,
COM1, FILENAME ....
v_h This is the number of lines on a page. The printer classes
uses line feeds to eject the page so this must reflect the
true number of lines your printer has per page. Default is
66, this works for dot matrix printers. Lasers will be less.
v_w This is the width of your printer. This number is the max_x
value when using printf, puts etc. All text will wrap beyond
this point. 132 is a good default even for 80 column
printers. The print library trims all spaces before printing,
so if you didn't print anything beyond column 80 your output
will be fine.
The height and width can be changed any time the printer is not opened,
using the same set_virtual message as in WinObj.
All WinObj formatting functions are available. printf, puts etc. You
even use the x/y coordinates because the page is formatted entirely in
memory before it prints. This allows you to skip to line 50 then back up
to 10. Pretty neat eh?
You can even use the get/read functions. They will print the data the
same as they would on the screen but will not prompt the user for
anything.
EXAMPLE:
main()
{
Win_Prn p;
double d = 123.12;
p.open ();
p.printf (10, 1, "This is a test on line 10 column 1");
p.puts (5, 1, "Same page on line 5");
p.puts (40, 1, "A double get:");
p.get (40, 15, d); // display a get.
p.print_page (); // actually print the page.
p.close (); // destructor will handle if you
wish.
}
Printer Object Routines
open
Opens the printer port/file and allocates the memory needed to preprint
the page.
USAGE: int open ();
RETURNS: W_OK
W_OPENED if already open.
W_ERROR misc errors.
===================================
Printer Setup Definitions:
Change the printer escape sequences which the system will use. The
defaults are Epson codes. They can be found in Win_Prn.hpp. Use these
routines to change the definitions for each Win_Prn object. Can be called
anytime.
USAGE:
void define_init (char *new_init);
void define_reset (char *new_reset);
void define_underline (char *new_underline);
void define_bold (char *new_bold);
void define_compress (char *new_compress);
void define_normal (char *new_normal);
init is called after the printer is opened.
reset is called before the printer is closed.
NOTES:
If you wish to disable one of these attributes call the
function with a NULL.
===================================
close
Closes the printer port/file and deallocates all used memory. This is
called by the destructor so you may not have to. You will want to use
this with networks to close the queue.
USAGE: void close ();
===================================
clean_page
This gives you a clean page to work on. All it really does is call
clr_win ();
USAGE: void clean_page ();
===================================
change_port
This allows you to change printer ports/files. You can only call this
when the port is not opened.
USAGE: int change_port (char *new_port);
new_port can be a printer port (LPT1, LPT2..) or any valid
dos file name.
RETURNS: W_OK
W_OPENED
===================================
print_page
This prints the page you formatted in memory. The page is not cleared
when it finishes. This allows you to reprint the page or add more data to
it if you wish. Use any of the WinObj functions to clear or reformat the
page.
USAGE: int print_page (int pages = 1);
pages number of copies to print.
RETURNS: W_OK
W_NOTOPEN
W_ERROR
===================================
set_pageattr
This changes the print attributes for the entire page. Can be called any
time. Useful when the same routines are used for painting the screen as
are used for printing a page. You wouldn't want your screen attributes to
come out on the printer.
USAGE: void set_pageattr (int new_attr);
new_attr any of the valid printer attributes. P_NORMAL,
P_UNDERLINE, P_COMPRESS, P_BOLD
NOTES:
Attributes can be ored (|) together, if your printer can
handle them.
Use these same attributes with the WinObj set_attr () to
change your attributes while painting the page.
Menu Objects
WinMenu <Object>
Menu objects are derived from WinObj objects. This means the window
messages are also available to the menu objects, with a few additions to
aid in the constructions of menus.
There are three necessary steps to creating a menu.
1.) Open the menu as you would any other window. This gives it a
location and color on the screen.
2.) Declare your menu selections. (prompt)
3.) Read the menu. This returns the user selection.
EXAMPLE:
main()
{
WinMenu m;
m.open (4, 23, 16, 53, W_SOLID,
_BLUE|WHITE, _BLUE|DGREY);
m.title ("[ Demo Menu ]");
m.prompt (1, 4, 1, "Data entry");
m.prompt (3, 4, 2, "Moving windows");
m.prompt (5, 4, 3, "Random windows");
m.prompt (7, 4, 4, "Menu demo");
m.prompt (9, 4, 0, "Quit");
int choice = m.read (1);
switch (choice)
{
case 1:
~~~~~~
break;
case 2:
~~~~~~
break;
~~~~~~
}
}
Menu Routines
prompt
declares a menu selection. The selection will not be displayed in the
window until you call read.
USAGE: int prompt (int y, int x, int return_val, char *str,
char *message = NULL, char hot_key = 0);
int prompt (int y, int x, int return_val, char *str,
char hot_key);
int prompt (int y, int x, WinMenu *sub, char *str,
char *message = NULL, char hot_key = 0);
int prompt (int y, int x, WinMenu *sub, char *str,
char hot_key = 0);
y The start row in the menu window.
x The start column in the menu window.
return_val The value you wish this selection to return.
str The prompt string.
message The message to display in the optional message box when
this prompt is pointed to.
hot_key The key the user can press to make the selection. The
default is the first character of str.
sub A pointer to a sub menu. This chains two menus
together. The main menus .read will return the read
value of the submenu. A sub menu can also have sub-
menus. See demo4.cpp for an example of sub menus.
RETURNS: W_NOMEM if out of memory.
W_NOTOPEN if the menu has not been opened.
W_OK
========================================
read
Read the user selection from the menu window. The user can use the arrow
keys to move from one selection to the next, then press Enter to make the
selection. The user can also press the hot letter of the menu selection.
The read function will also unhide a previously hidden menu object.
USAGE: int read (int start_pos);
start_pos the first selection to point to. The read function will
attempt to match start_pos with one of the return_vals
used in the prompt function. It will then point to this
selection first.
RETURNS: W_ERROR if no prompts were activated.
W_ESCAPE if escape was used to exit.
Otherwise it returns the return_val of the user selected
prompt.
Notes: When read is called on a menu which has sub menus, the sub
menus are hidden before the user is prompted. The read will
not return until a prompt with a ret_value is selected by the
user. If a prompt with a WinMenu * is selected by the user
that menu will be displayed and again prompt the user. The
sub-menu path the user took will be left unhidden when the
read returns. See demo4.cpp for an example of sub menus.
========================================
reset
This resets a menu object and closes it so you can use it again for a
different type of menu.
USAGE: void reset ();
========================================
set_barattr
This sets the attribute for the menu selection bar. The default is
_LGREY|BLACK.
USAGE: int set_barattr (int attr);
RETURNS: the previous attribute.
========================================
set_keyattr
This sets the attribute for the hot key of a selection. The default is
the same attribute as the rest of the selection.
USAGE: int set_keyattr (int attr);
RETURNS: the previous attribute.
========================================
set_type
This sets the menu type, which helps control its behavior when its a sub-
menu.
USAGE: void set_type (int new_type);
valid types: MENU_VERT (default)
MENU_HORZ
MENU_POPUP
MENU_SUB
MENU_LOTUS
Menu_Vert and Menu_Horz can be or-ed with one of the other types.
========================================
message_line
This sets the screen line to display a menu message. The menu read
message will open a 1 line window using this entire screen line. Your
declared messages will be displayed in this window as the user moves the
menu bar.
USAGE: int message_line (int new_line_no);
new_line_no = the line number to use. If this is less than 0 no message
line will be used. The menu object default is -1;
RETURNS: the previous line number.
EXAMPLE:
main() // A lotus style menu.
{
WinMenu m;
m.open (1,0,1,79,W_NOBORDER,_BLUE|WHITE);
m.message_line (2);
m.prompt (0, 1,1,"Worksheet","Global, Column, Status, Delete");
m.prompt (0,12,2,"Range","Format, Label, Erase, Justify, Prot");
m.prompt (0,19,3,"Copy","Copy a cell or range of cells");
m.prompt (0,25,4,"Move","Move a cell or range of cells");
m.prompt (0,31,5,"File","Retrieve, Save, Combine, Xtract...");
m.prompt (0,37,6,"Print","Print a worksheet to a printer or file");
m.prompt (0,44,0,"Quit","Quit the menu demo");
int choice=1;
while (choice != 0)
{
choice = m.read(choice);
switch (choice)
{
case 1:
menu_demo2 ();
break;
case 2:
break;
}
}
}
========================================
message_attr
Changes the attribute for the message line. The default is _BLACK|WHITE.
USAGE: int message_attr (int new_attr);
RETURNS: the previous attribute.
Pick-List Objects
WinPick <Object>
Pick-List objects are derived from WinObj objects. This means the window
messages are also available to the pick-list objects, with a few additions
to aid in the construction of pick-lists.
There are three necessary steps to creating a pick-list.
1.) Open the pick-list window the same as you would open any other
window. This gives it a location and color on the screen.
2.) Assign a char * array to the list object.
3.) Read the pick list. This returns the user selection.
EXAMPLE:
char *list[] = { "January","February",
"March","April",
"May","June",
"July","August",
"September","October",
"November","December", 0 };
void main()
{
WinPick pl;
pl.open (6,41,11,53,W_DOUSIN,_BLUE|WHITE,_BLUE|BLACK);
pl.prompt (list);
int choice = pl.read();
WinObj w;
w.open (6,23,11,53,W_DOUSIN,_BLUE|WHITE,_BLUE|BLACK);
w.printf (1,1,"You picked %s.",list[choice]);
w.set_attr(_BLUE|LGREY);
w.printf (3,1,"Press any key to continue.");
w.get_key();
}
Pick-List Routines
prompt
assigns an array of characters pointers to the list object. This can be
any size list of character strings. The last element of the list must be
a NULL pointer, or you must provide a count of items to pick from.
USAGE: void prompt (char *list[], int count = -1);
list a pointer to the list of strings.
count the number of elements to pick from. (Optional) if you
omit this parameter the WinPick object will search for
a NULL to determine the end of the list.
========================================
read
Gets the users choice from the pick list.
USAGE: int read();
User Keys:
Up, Down Point to the Previous/Next in list
PgUp, PgDn Move one window page.
Home, End. Move to the First/Last in list
A match is attempted on any other key press. The match is to the
first letter/number of a field. The search is started from the next
field to the end then back to beginning of the list.
RETURNS: the element number of the users selection.
W_ERROR if the list window is not opened.
W_ESCAPE if list is exited with an escape.
========================================
set_barattr
Sets the attribute for the pick-list bar. The default is _LGREY|BLACK
USAGE: int set_barattr (int new_attr);
RETURNS: the previous attribute.
Paradox Related Routines
The Paradox functions work similar to the regular get/read functions. The
exception is, these functions work directly on a Paradox record buffer, so you
need not move data from the buffers to temporary variables. Do to the Paradox
being a large model library, these functions are available in the Large model
only.
EXAMPLE:
#include <pxengine.h>
#include "winobj.hpp"
main ()
{
TABLEHANDLE TblHandle;
RECORDHANDLE RecHandle;
PXInit (); // Init the PX engine
PXTblOpen ("SALES", &TblHandle, 0, 0); // Open the table
PXRecBufOpen (TblHandle, &RecHandle); // Open a record buffer
PXRecFirst (TblHandle); // Point to the first record
PXRecGet (TblHandle, RecHandle); // Read the record.
WinObj w; // my window object
w.open (0, 0, 24, 79); // Open the window
w.PXrecord (TblHandle, RecHandle); // give winobj the PX info
w.PXget (1, 1, 1, 'F'); // Get the first field, style 'F'
w.PXget (3, 1, 2, 'F');
w.PXget (5, 1, 11, 'P'); // Get the 11 field, style
Phone
w.PXget (7, 1, 17, 10, 2);
w.PXget (9, 1, 18, 3, 0);
w.PXread (); // Read the user input
PXRecUpdate (TblHandle, RecHandle); // update the PX record
PXExit (); // Stop the PX engine
}
========================================
PXrecord
Defines the Paradox table and record handles to LVS Windows.
- You must first open the PX table and record buffer.
- You must call this function before any PXget calls.
- You can PXget data from more than one PX table by calling
this function between the gets.
USAGE: void PXrecord(TABLEHANDLE t, RECORDHANDLE r);
========================================
PXget
Work like 'get' to define a get field on the screen. The field is
displayed when PXget is called. There is more than one way to call
a PXget. The length of Ascii fields will be set to the length in
the PX table.
USAGE:
int PXget (int y, int x, FIELDHANDLE f)
- Generic PXget. Used to get any field type.
- Strings will be of style 'A'ny character.
- Dates will be of style DATE_STYLE.
- Numbers will be input as len of 10 with 2 decimals.
int PXget (int y, int x, FIELDHANDLE f, int len, int dec)
- Used to input PX number fields only. Ascii or Date
fields will return an error.
- Decimals can be from 0 - (1 less than len)
int PXget (int y, int x, FIELDHANDLE f, char style)
- Used to input Ascii or Date fields
- You can use any of the valid 'get' styles.
- Date fields will be forced to type 'D'.
int PXget (int y, int x, FIELDHANDLE f, char *picture)
- Used to input Ascii fields only.
- You can use any of the valid 'get' pictures.
RETURNS:
W_OK
W_ERROR if PXrecord not called, the windows isn't open or
an invalid field type for the PXget.
========================================
PXread
Read the PXgets from the user. This works just like 'read ()'. You
must call PXread when any of your gets are from a Paradox record
buffer. Not all the gets have to be of type PXget. The PXread
function will work on any regular get.
USAGE: int PXread ();
RETURNS: Key pressed to exit read. User can exit with an Enter
on the last field, Escape, PgUp or PgDn.High Level Tools
Win_Calendar
Display a simple calendar on the screen. The calendar will first
display with the current month. The user can change the date using
the arrow keys. Escape or Q exits the calendar. The calendar can
be used in a Win_setonkey assignment.
USAGE: void Win_Calendar ();
========================================
Win_Calculator
Display a simple calculator on the screen. This is a basic 4
function calculator. ( +-*/ ) Enter is the same as =. C = Clear,
E = ClearEntry, S = toggle sign of result, R = Square Root of
result.
The calculator can be assigned a got key with Win_setonkey.
USAGE: void Win_Calculator ();
========================================
Win_Error
Display an error message on the screen. Wait 10 seconds for a user
key press to exit the message.
USAGE: void Win_Error (char *msg = "Error",
int win_attr = _RED|BLACK,
int bor_attr = _RED|WHITE);
msg Error message to display. Default = "Error"
win_attr Message window attribute.
bor_attr Message window border attribute.
========================================
Win_Ask_YN
Display a message in a window and wait for a user Y or N response.
USAGE: int Win_Get_YN (char *msg = "Yes or No",
int winattr = _GREEN|BLACK,
int borattr = _GREEN|BLACK);
msg Question to ask user.
winattr Window attribute.
borattr Border attribute.
========================================
Win_Get_Choice
Prompt the user for a single key response. All user responses will
be converted to upper case.
USAGE: char Win_Get_Choice (char *msg, char *choices,
int win_attr = _GREEN|BLACK,
int bor_attr = _GREEN|WHITE);
msg Question to ask the user.
choices Possible letter choices for the user.
winattr Window attribute.
borattr Border attributes.
RETURNS: the users response.Global Window Object Routines
Win_whos_active
Returns an object pointer to the currently active window object. This is
a friend function to WinObj class.
USAGE: WinObj *Win_whos_active ();
RETURNS: A pointer to the currently active window or NULL if none are
active.
EXAMPLE:
WinObj *w;
w = Win_whos_active ();
w->title ("I'm the active window");
========================================
Win_close_all
Close all open windows. This routine is provide to allow you to clean up
the screen before calling the exit () function. Normaly windows are close
when the destructors are called. However when you call exit() the
destructors are not called and the windows remain open on the screen. If
your program exits normaly by returning to main() you won't need this
function. If you call exit() while any windows are open you may want to
call this routine.
USAGE: void Win_close_all ();
Low Level Routines
Screen Functions
Win_init
Start the low level screen system. This is called automatically by the
first window function used. This function will clear the screen the first
time it is called. You can call this function manually to take advantage
of the mode flags.
USAGE: void Win_init (int mode);
mode: W_MONO = Force mono attributes only.
W_BIOS = Force bios screen writes.
W_DEFAULT = Auto detect the system configuration.
W_SNOW = Force CGA snow checking.
W_NOCLEAR = don't clear the screen during init.
Any of these modes can be combined by oring.
example: Win_init (W_BIOS | W_MONO);
========================================
Win_clr
Clear a section of the screen with an attribute.
No testing is done on screen coordinates.
USAGE: void Win_clr (int sr,int sc, int er, int ec,int color);
========================================
Win_clrscr
Clear the entire display screen.
USAGE: void Win_clrscr ();
========================================
Win_currentmode
Return the current screen write modes.
The modes returned will be | together.
USAGE: int Win_currentmode ();
RETURNS: current screen write modes.
EXAMPLES: if (Win_currentmode () & W_MONO)
then mono mapping is on
========================================
Win_dispch
Display a character on the screen.
No coordinate testing is done.
USAGE: void Win_dispch (int y, int x, int color, char ch);
========================================
Win_DesqView_Aware
Allow your application to give up clock ticks when waiting for user input.
USAGE: int Win_DesqView_Aware ();
RETURNS: version of DesqView running. 0 if not in DesqView.
Notes: DesqView is a trade mark of Quarterdeck.
========================================
Win_dispst
Display a NULL terminated string on the screen.
USAGE: void Win_dispst ( int y, int x, int color,
char *str, int max );
x/y coordinates 0,0 origin.
color attribute.
str pointer to string.
max max number of characters to display in case string is
not null terminated.
========================================
Win_gotoxy
Move the cursor on the screen. 0,0 origin.
USAGE: void Win_gotoxy (int y, int x);
========================================
Win_hidecur
Hide the screen cursor.
USAGE: void Win_hidecur();
========================================
Win_getpage
Get the active video page. Also adjust the low level video segment for
direct screen writes.
USAGE: int Win_getpage ();
RETURNS: the number of the active page. 0-3
========================================
Win_restore
Restore a sectoin of the screen saved with Win_save. The buffer will be
freed by this routine.
USAGE: void Win_restore (int ulr, int ulc, int lrr, int lrc,
int *scr_data);
ulr, ulc, lrr, lrc screen coordinates. uses sames as Win_save.
scr_data value returned from Win_save.
========================================
Win_save
Save a section of the screen. This routine will allocate the memory
needed for the save. NULL will be returned if no memory was available.
USAGE: int *Win_save (int ulr, int ulc, int lrr, int lrc);
ulr upper left row (y)
ulc upper left column (x)
lrr lower right row (y2)
lrc lower right column (x2)
RETURNS: pointer to the saved screen data. NULL if not enough memory
or invalid screen coordinates are used. You will need this
pointer to restore the section of screen.
========================================
Win_setpage
Set the active video page. After setting the page Win_getpage will be
called to adjust the video segment.
USAGE: int Win_setpage (int new_page);
new_page 0 - 3
RETURNS: W_OK, W_ERROR if an invalid page.
========================================
Win_settabsize
Set the tab size for printf, puts and putch. The tab size is only in
effect when translate is on. The default is 4 spaces.
USAGE: int Win_settabsize ();
RETURNS: previous tab size.
========================================
Win_showcur
Unhide the screen cursor.
USAGE: void Win_showcur();
========================================
Win_beep
Beep the speaker.
USAGE: void Win_beep();
========================================
Win_mono
Turn black & white color re-mapping on or off.
USAGE: void Win_mono (int on_off);
Call with W_ON or W_OFF
========================================
Win_snow
Turn snow checking on or off.
USAGE: void Win_snow(int on_off);
Call with W_ON or W_OFF
========================================
Win_bios
Turn bios writes on or off.
USAGE: void Win_bios (int on_off);
Call with W_ON or W_OFF
VGA Functions
VGA_fontload
Loads the special line drawing characters for window borders. You can
make this call as often as you like. There is no undo for this call.
This gives your windows more of a graphic look.
This routine remaps some of the seldom used line drawing characters. It
then calles Win_Load_Alt_Border () to point all border types at the new
characters.
This routine will do nothing if a vga color monitor is not detected. So
you can make the call with an monitor type.
USAGE: int VGA_fontload ();
RETURNS: W_ERROR if a non VGA-color is detected.
W_OK if the font was loaded.
========================================
VGA_videotype
Determines the video type.
USAGE: int VGA_video_type ();
RETURNS: V_VGA, V_EGA, V_CGA, V_MCGA, V_MONO
========================================
VGA_setblink
Toggles attribute blink mode. Allows highlighted background on VGA
displays.
USAGE: int VGA_set_blink (int on_off);
on_off W_ON allows blinking attributes.
W_OFF allows highlighted background.
RETURNS: W_OK
W_ERROR if not a VGA screen
========================================
VGA_setlines
Change the number of text lines per screen on VGA displays.
USAGE: int VGA_setlines (int line_cnt);
line_cnt 25, 28, 43, or 50
RETURNS: W_OK
W_ERROR if not a VGA screenKey Functions
Win_getkey
Get a key stroke from the keyboard. You can have a time out on the key.
If the no key is pressed in the time out period 0 will be returned.
USAGE: int Win_getkey(int seconds = 0);
seconds = max time to wait for a key.
default = 0. 0 = wait forever.
RETURNS: scan code + ascii value of key pressed.
Scan code = key >> 8
ascii value = key & 0x00ff
========================================
Win_keystuf
Stuff a keystroke in the internal buffer.
USAGE: int Win_keystuf (int key);
key = Scan code + ascii value of key to stuff.
Key strokes are stacked not queued. If you wish to display
a string you must insert the keystrokes in reverse.
Example:
char *str = "Keyboard stuff routine";
int i = strlen(str);
while (i)
Win_keystuf(str[--i]);
RETURNS: W_OK or W_ERROR if the buffers is full.
Buffer holds 40 keystrokes.
========================================
Win_keywaiting
Returns true if a key stroke is waiting.
USAGE: int Win_keywaiting ();
RETURNS: TRUE if key is waiting else false
========================================
Win_lastkey
Return the last key gotten by Win_getkey
USAGE: int Win_lastkey ();
RETURNS: scan code + ascii value of key gotten.
========================================
Win_setonkey
Assign a function to a hot key. You may use as may hot keys
as you like. You can turn off a hot key by assigning the
key to NULL.
USAGE: void Win_setonkey (int key,void (* func)(void));
key = scan code/ascii code combination of hot key.
Many of the keys are defined in WIN.H
func = pointer to the hot key function. If NULL then
hot key will be deactivated.
========================================
Win_setbkloop
Assign a function to execute while waiting for a keypress. You can only
have one function assigned at a time. To turn off this process assign
NULL.
USAGE: void Win_setbkloop (void (* func)(void));
String Functions
str_clear
Clears a string to a given number of spaces
USAGE: char *str_clear (char *str, int len);
str = String to be cleared.
len = New length of string.
RETURNS: a pointer to str.
========================================
str_setsz
Sets the size of a char string.
USAGE: char *str_setsz (char *str, int len);
str = String to be truncated or padded.
len = New length of string.
RETURNS: pointer to str.
========================================
strfill
Return a string filled with a character.
USAGE: char *strfill (char ch,int count);
ch = character to use.
cnt = length of return string. MAX of 149.
RETURNS: pointer to a static string buffer or NULL if invalid length.
========================================
strtrim
Trims trailing spaces from a string.
USAGE: char *strtrim (char *str);
RETURNS: pointer to the string which was trimmed.
Revision History
vc.0 1/10/91
First Release of LVS Windows.
vc.1 2/12/91
* Added functions
- char *get_version ()
- int set_getattr (int)
* Enhanced performance
* Fixed a few misc bugs
v1.11a 2/25/91
* Moved WinObj & WinPick destructor out side of include file.
* Added Functions:
- int update_get ()
v1.12 2/28/91
* Fixed a bug which cropped up when using BC++ in place of TC++
v1.2 3/05/91
* Improved window update performance.
* gotoxy (y,x) printf (y,x,...) and bprintf (y,x,..) have been
modified. When y is 1 greater than max_y () the window will scroll
up 1 line and insert a new one at the end.
* Added access to show_cursor ().
* get_version () now returns a pointer to "LVS Windows v###".
v1.3 3/15/91
* Added putch() and puts() as fast alternatives to printf().
* Increased speed of update function for active window.
* Enhanced WinPick::read (). Added Home / End keys, also search
for list item match to key press.
* Fixed major bug in hide (). Caused infinite loop.
v1.3a 3/20/91
* Improved speed of update (), Win_dispch() and Win_dispatst().
v1.5 4/18/91
* Renamed to LVS Windows.
* Improved get system.
- Added integer get.
- Added before (); before get function call.
- Cleaned up obj pointers.
* Added box (); box drawing in a window
* Added WinTools.HPP
- Win_Calculator ()
- Win_Calendar ()
- Win_Error ()
- Win_Get_YN ()
- Win_Get_Choice ()
* Added seconds parameter to Win_getkey (int seconds = 0);
- Allows time out for key if desired.
- Default is 0, (forever).
- This parameter also caries over to w.get_key ();
* Now compile Win_low.c & Win_func as a c++ file.
- Not sure why I ever compiled as C.
* Added len parameter to:
w.get (int y, int x, char *str, char style, int len);
* Changed some key functions to virtual.
* Added Win_Prn class.
- This is a powerful printer class which gives you all
the output power of a WinObj object to your printer.
- All the printf, puts, putc and gets will format to
your printer like they would to the screen. (except for
color)
- Set any page size. Paint an entire page at a time in
memory, then print the page. Start with a clear page or
where you left off to get the next page.
- This print method allows random printing on a page.
even with dot matrix printers.
- Has ability to Underline, Bold, and Compress print.
The defaults are Epson codes, but you can change them.
v1.51 4/25/91
* Added some PC Information functions.
Share_Loaded ();
Print_Loaded ();
Assign_Loaded ();
Himem_Loaded ();
Novell_Loaded ();
* Made shadows transparent.
* Fixed a hole in WinObj::open (), which allowed an invalid border
type.
* Fixed a hole in WinMenu::message, which didn't account for a null
message.
v1.52 5/20/91
* Added get () for single characters
* Added wherey () and wherex ()
v1.6 6/01/91
* Added update_all () to update all open, unhidden windows.
* Added support for Paradox Engine reads and gets.
- Now you can read and get fields directly from the
Paradox record buffer.
- Added: PXrecord (), PXget (), and PXread ();
- See Paradox section of doccumentation.
* Revised Screen painter to produce support code for
the Paradox Engine.
* Paradox is a trademark of Borland.
v1.62 6/07/91
* Added optional parameter to WinMenu.prompt ();
- hot key. This allows you to select a hot key other
than the first key in the string.
* Added WinMenu.set_keyattr ();
- Allows you to pick a different attribute for the hot key
in a menu.
* Added WinObj.any_read_change ();
- Allows you to see if the user made any changes during
the last read.
v1.63 6/11/91
* Win_Get_YN () now accepts an ESC as a no.
* 'F' style in gets now changes the first letter of each word in
a get to upper case.
v2.0 08/20/91
* Added mouse support.
* Tab/Shift Tab changes to next/previous field.
* Changed method for inputing doubles. and fixed bug.
* Support for Zortech 3.0 C++ compiler.
* 50/28 line VGA support.
* Added border type 6.
* add WinObj *Win_whos_active ().
* Added overloading of << operator for output.
* '\n' now causes a cr/lf in a window when using puts, putch, printf
and <<. These can be controlled with the translate flag.
* Added printf_translate () to change translate mode.
v2.01 08/26/91
* Added start parameter to pick list read ().
* Move cursor after decimal with doubles.
* Fixed some minor bugs.
v2.02 09/11/91
* Added void Win_close_all(), to close all windows.
v2.1 09/27/91
* New look for scroll bars. more Windows like.
* Smother border redraw routine. Improves moves and resizeing.
* Better grabbing routine when moving a window with the mouse.
* Better scroll bars for Pick Lists.
v2.11 10/01/91
* Added W_NOCLEAR flag to Win_init ();
* Added Win_save() and Win_restore();
v2.2 10/10/91
* Smoothed window moves and resizes.
* Added Win_settabsize ();
* \t no translated in printf, puts and putch
v2.3 10/15/91
* the title_str parameter in title() is now copied into a buffer.
You can now pass a local string.
* More VGA support -- New box drawing characters.
v2.31 10/25/91
* mono attributes now map correctly for menu bars.
* added Win_currentmode ().
v3.0 2/18/92
* Added new get types: Push Buttons, Radio Buttons & Check Boxes
* Rewrote most of the data entry routines. Much cleaner now, and
more OOPS.
* Fixed Win_save & Win_restore when in bios mode
* Added ScreenState class for restoring previous screen modes
* Added #define(s) for get styles
* Added Win_keywaiting ()
* Removed direct support for Snow Checking. Switch still works but
now acts like bios writes.
* Added 43 line VGA mode. Forces 350 scan lines.
* Changed user pan keys to CTRL_U,D,R and L. Now use Ctrl arrows
for moving in data entry fields.
* Now every get has its own attribute. Prior to creating the get
use set_getattr () to change its get attribute.
* Added a new constructor to allow arrays of window objects.
* Added Win_DesqView_Aware (). Allows your app give up processesor
time while waiting for user input.
v3.1
* Added the ability to hide a window before opening it. This allows
you to paint the entire window in memory and display it later.
* Fixed a minor bug in the menu class.
* When a background function exists the keyboard routines now ensure
the active window stays active, regardless what the background
function does.
* Added more prompt types for WinMenu objects.
* Added true submenu support for WinMenu objects. See demo4.cpp
* Added allow_user_moves (). Index
Declaring a Window Object. . . . . . . . . . . . . . 6
Features of LVS Windows. . . . . . . . . . . . . . . 2
Files Included . . . . . . . . . . . . . . . . . . . 5
Global Window Routines . . . . . . . . . . . . . . .42
Win_close_all. . . . . . . . . . . . . . . . .42
Win_whos_active. . . . . . . . . . . . . . . .42
High Level Tools . . . . . . . . . . . . . . . . . .40
Win_Ask_YN . . . . . . . . . . . . . . . . . .40
Win_Calculator . . . . . . . . . . . . . . . .40
Win_Calendar . . . . . . . . . . . . . . . . .40
Win_Error. . . . . . . . . . . . . . . . . . .40
Win_Get_Choice . . . . . . . . . . . . . . . .40
Information Routines . . . . . . . . . . . . . . . .26
do_youown. . . . . . . . . . . . . . . . . . .26
get_pan. . . . . . . . . . . . . . . . . . . .26
get_scr. . . . . . . . . . . . . . . . . . . .26
get_version. . . . . . . . . . . . . . . . . .26
is_open. . . . . . . . . . . . . . . . . . . .26
max_x. . . . . . . . . . . . . . . . . . . . .27
max_y. . . . . . . . . . . . . . . . . . . . .27
ret_attr . . . . . . . . . . . . . . . . . . .27
ret_char . . . . . . . . . . . . . . . . . . .27
wherex . . . . . . . . . . . . . . . . . . . .27
wherexy. . . . . . . . . . . . . . . . . . . .28
wherey . . . . . . . . . . . . . . . . . . . .28
who_owns . . . . . . . . . . . . . . . . . . .28
Input Routines . . . . . . . . . . . . . . . . . . .19
any_read_change. . . . . . . . . . . . . . . .25
before . . . . . . . . . . . . . . . . . . . .19
clear_gets . . . . . . . . . . . . . . . . . .24
get. . . . . . . . . . . . . . . . . . . . . .20
get_button . . . . . . . . . . . . . . . . . .22
get_checkbox . . . . . . . . . . . . . . . . .23
get_key. . . . . . . . . . . . . . . . . . . .19
get_radio. . . . . . . . . . . . . . . . . . .23
read . . . . . . . . . . . . . . . . . . . . .25
set_getattr. . . . . . . . . . . . . . . . . .24
update_gets. . . . . . . . . . . . . . . . . .24
valid. . . . . . . . . . . . . . . . . . . . .24
Key Functions. . . . . . . . . . . . . . . . . . . .48
Low Level Routines . . . . . . . . . . . . . . . . .43
str_clear. . . . . . . . . . . . . . . . . . .50
str_setsz. . . . . . . . . . . . . . . . . . .50
strfill. . . . . . . . . . . . . . . . . . . .50
strtrim. . . . . . . . . . . . . . . . . . . .50
VGA_fontload . . . . . . . . . . . . . . . . .47
VGA_setblink . . . . . . . . . . . . . . . . .47
VGA_setlines . . . . . . . . . . . . . . . . .47
VGA_videotype. . . . . . . . . . . . . . . . .47
Win_beep . . . . . . . . . . . . . . . . . . .45
Win_bios . . . . . . . . . . . . . . . . . . .46
Win_clr. . . . . . . . . . . . . . . . . . . .43
Win_currentmode. . . . . . . . . . . . . . . .43
Win_DesqView_Aware . . . . . . . . . . . . . .44
Win_dispch . . . . . . . . . . . . . . . . . .43
Win_dispst . . . . . . . . . . . . . . . . . .44
Win_getkey . . . . . . . . . . . . . . . . . .48
Win_getpage. . . . . . . . . . . . . . . . . .44
Win_gotoxy . . . . . . . . . . . . . . . . . .44
Win_hidecur. . . . . . . . . . . . . . . . . .44
Win_init . . . . . . . . . . . . . . . . . . .43
Win_keystuf. . . . . . . . . . . . . . . . . .48
Win_keywaiting . . . . . . . . . . . . . . . .48
Win_lastkey. . . . . . . . . . . . . . . . . .48
Win_mono . . . . . . . . . . . . . . . . . . .45
Win_restore. . . . . . . . . . . . . . . . . .44
Win_save . . . . . . . . . . . . . . . . . . .45
Win_setbkloop. . . . . . . . . . . . . . . . .49
Win_setonkey . . . . . . . . . . . . . . . . .48
Win_setpage. . . . . . . . . . . . . . . . . .45
Win_settabsize . . . . . . . . . . . . . . . .45
Win_showcur. . . . . . . . . . . . . . . . . .45
Win_snow . . . . . . . . . . . . . . . . . . .46
Menu Objects . . . . . . . . . . . . . . . . . . . .32
Menu Routines. . . . . . . . . . . . . . . . . . . .33
message_attr . . . . . . . . . . . . . . . . .35
message_line . . . . . . . . . . . . . . . . .35
prompt . . . . . . . . . . . . . . . . . . . .33
read . . . . . . . . . . . . . . . . . . . . .33
reset. . . . . . . . . . . . . . . . . . . . .34
set_barattr. . . . . . . . . . . . . . . . . .34
set_keyattr. . . . . . . . . . . . . . . . . .34
set_type . . . . . . . . . . . . . . . . . . .34
Mouse Routines . . . . . . . . . . . . . . . . . . .16
set_mouseroutine . . . . . . . . . . . . . . .18
Win_mouse_mode . . . . . . . . . . . . . . . .18
Paradox Routines . . . . . . . . . . . . . . . . . .38
PXget. . . . . . . . . . . . . . . . . . . . .39
PXread . . . . . . . . . . . . . . . . . . . .39
PXrecord . . . . . . . . . . . . . . . . . . .38
Pick-List Objects. . . . . . . . . . . . . . . . . .36
Pick-List Routines . . . . . . . . . . . . . . . . .37
prompt . . . . . . . . . . . . . . . . . . . .37
read . . . . . . . . . . . . . . . . . . . . .37
set_barattr. . . . . . . . . . . . . . . . . .37
Printer Object Routines. . . . . . . . . . . . . . .30
change_port. . . . . . . . . . . . . . . . . .31
clean_page . . . . . . . . . . . . . . . . . .30
close. . . . . . . . . . . . . . . . . . . . .30
open . . . . . . . . . . . . . . . . . . . . .30
print_page . . . . . . . . . . . . . . . . . .31
set_pageattr . . . . . . . . . . . . . . . . .31
Printer Objects. . . . . . . . . . . . . . . . . . .29
Registration Information . . . . . . . . . . . . . . 3
Screen Functions . . . . . . . . . . . . . . . . . .43
String Functions . . . . . . . . . . . . . . . . . .50
The << operator. . . . . . . . . . . . . . . . . . .15
VGA Functions. . . . . . . . . . . . . . . . . . . .47
WinObj Routines. . . . . . . . . . . . . . . . . . . 7
Border . . . . . . . . . . . . . . . . . . . .10
box. . . . . . . . . . . . . . . . . . . . . . 7
center . . . . . . . . . . . . . . . . . . . . 7
change_border. . . . . . . . . . . . . . . . . 7
close. . . . . . . . . . . . . . . . . . . . . 8
clr_eol. . . . . . . . . . . . . . . . . . . . 8
clr_win. . . . . . . . . . . . . . . . . . . . 8
del_line . . . . . . . . . . . . . . . . . . . 8
gotoxy . . . . . . . . . . . . . . . . . . . . 9
hide . . . . . . . . . . . . . . . . . . . . . 9
ins_line . . . . . . . . . . . . . . . . . . . 9
move . . . . . . . . . . . . . . . . . . . . . 9
open . . . . . . . . . . . . . . . . . . . . .10
pan. . . . . . . . . . . . . . . . . . . . . .10
printf . . . . . . . . . . . . . . . . . . . .11
putch. . . . . . . . . . . . . . . . . . . . .11
puts . . . . . . . . . . . . . . . . . . . . .11
set_active . . . . . . . . . . . . . . . . . .11
set_attr . . . . . . . . . . . . . . . . . . .12
set_fill . . . . . . . . . . . . . . . . . . .12
set_virtual. . . . . . . . . . . . . . . . . .12
size . . . . . . . . . . . . . . . . . . . . .13
title. . . . . . . . . . . . . . . . . . . . .13
unhide . . . . . . . . . . . . . . . . . . . .13
update . . . . . . . . . . . . . . . . . . . .13
update_all . . . . . . . . . . . . . . . . . .14
user_move. . . . . . . . . . . . . . . . . . .14